package com.baizhi.controller;

import com.baizhi.entity.CmfzArticle;
import com.baizhi.service.CmfzArticleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("article")
public class CmfzArticleController {
    @Autowired
    private CmfzArticleService cmfzArticleService;

    @GetMapping("selectArticle")
    public List<CmfzArticle> selectArticle(int size){
        log.info("查询最新文章参数："+size);
        List<CmfzArticle> cmfzArticles = cmfzArticleService.selectArticle(size);
        return cmfzArticles;
    }
    @GetMapping("selectArticleByGuruId")
    public List<CmfzArticle> selectArticleByGuruId(String type,int guruId){
        log.info("查询上师文章参数type="+type+",guruId="+guruId);
        List<CmfzArticle> cmfzArticles = cmfzArticleService.selectArticleByGuruId(type, guruId);
        return cmfzArticles;
    }
}
